package NetWork;

import java.io.IOException;
import java.io.OutputStream;
import java.net.*;
import java.nio.charset.StandardCharsets;

public class UDP_Client {
    public static void main(String[] args) {
        String message = "TestUDP";
        byte[] bytes = message.getBytes();
        try {
            DatagramSocket datagramSocket = new DatagramSocket();
            DatagramPacket datagramPacket = new DatagramPacket(bytes
            ,0,bytes.length,new InetSocketAddress(InetAddress.getByName("localhost"),8888)
            );
            datagramSocket.send(datagramPacket);
            datagramSocket.close();
        } catch (SocketException e) {
            e.printStackTrace();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}
